﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Game.model.actor.instances.player
{
    public class RecomBonus
    {
        private static int[,] _recoBonus = new[,] 
	    {
		    {
			    25,
			    50,
			    50,
			    50,
			    50,
			    50,
			    50,
			    50,
			    50,
			    50
		    },
		    {
			    16,
			    33,
			    50,
			    50,
			    50,
			    50,
			    50,
			    50,
			    50,
			    50
		    },
		    {
			    12,
			    25,
			    37,
			    50,
			    50,
			    50,
			    50,
			    50,
			    50,
			    50
		    },
		    {
			    10,
			    20,
			    30,
			    40,
			    50,
			    50,
			    50,
			    50,
			    50,
			    50
		    },
		    {
			    8,
			    16,
			    25,
			    33,
			    41,
			    50,
			    50,
			    50,
			    50,
			    50
		    },
		    {
			    7,
			    14,
			    21,
			    28,
			    35,
			    42,
			    50,
			    50,
			    50,
			    50
		    },
		    {
			    6,
			    12,
			    18,
			    25,
			    31,
			    37,
			    43,
			    50,
			    50,
			    50
		    },
		    {
			    5,
			    11,
			    16,
			    22,
			    27,
			    33,
			    38,
			    44,
			    50,
			    50
		    },
		    {
			    5,
			    10,
			    15,
			    20,
			    25,
			    30,
			    35,
			    40,
			    45,
			    50
		    },
		    {
			    4,
			    9,
			    14,
			    18,
			    23,
			    28,
			    33,
			    37,
			    40,
			    50
		    }
	    };
        public static int getRecoBonus(Player activeChar)
        {
            if ((activeChar != null) && activeChar.isOnline())
            {
                if (activeChar.getRecomHave() == 0)
                {
                    return 0;
                }
                var _lvl = (int)java.lang.Math.ceil(activeChar.getLevel() / 10);
                var _exp = (int)java.lang.Math.ceil((java.lang.Math.min(100, activeChar.getRecomHave()) - 1) / 10);
                return _recoBonus[_lvl,_exp];
            }
            return 0;
        }
        public static double getRecoMultiplier(Player activeChar)
	    {
		    double bonus = getRecoBonus(activeChar);
		    if (bonus > 0)
		    {
			    return 1.0 + (bonus / 100);
		    }
		    return 1.0;
	    }
    }
}
